//
//  goodsCell.m
//  团购菜单
//
//  Created by 伍银荣 on 2021/6/3.
//  Copyright © 2021 com.example. All rights reserved.
//

#import "goodsCell.h"
#import "Goods.h"

@interface goodsCell ()

@property (strong, nonatomic) IBOutlet UIImageView *imgView;
@property (strong, nonatomic) IBOutlet UILabel *titleLabel;
@property (strong, nonatomic) IBOutlet UILabel *priceLabel;
@property (strong, nonatomic) IBOutlet UILabel *buyCountLabel;

@end

@implementation goodsCell

-(void)setGoodsModel:(Goods *)goodsModel {
    _goodsModel = goodsModel;
    self.imageView.image = [UIImage imageNamed:goodsModel.icon];
    self.titleLabel.text = goodsModel.title;
    self.priceLabel.text = [NSString stringWithFormat:@"¥ %@",goodsModel.price];
    self.buyCountLabel.text = [NSString stringWithFormat:@"已有%@人购买",goodsModel.buyCount];
}

+(instancetype)goodsCellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"goods_ID";
    goodsCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"goodsCell" owner:nil options:nil] lastObject];
    }
    return cell;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
